package com.itheima.socketdemo6;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10001);
//        System.out.println(111);
        Socket socket = ss.accept();
        System.out.println(222);
        InputStream is = socket.getInputStream();
        BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
        String s;
        while ((s = br.readLine()) != null) {
            System.out.println(s);
        }

        is.close();
        ss.close();
    }
}
